package com.wlc.base;

import java.util.Scanner;

/**
 * @author 王立朝 wanglichao@champion-credit.com
 * @description 计算长方体，正方体，圆的面积
 * @date 2021-09-02 13:05
 */
public class MianJi {
    float r;
    float pai = (float) 3.14;

    void t() {
        Float s = pai * r * r;
        System.out.println("圆的面积为" + s);
    }

    void t(float bianChang) {
        System.out.println("正方形的面积为" + bianChang * bianChang);
    }

    void t(float chang, float kuan) {
        System.out.println("长方形的面积为" + chang * kuan);
    }

    public static void main(String[] arg) {
        MianJi c = new MianJi();
        System.out.println("请输入圆的半径：");
        Scanner sc = new Scanner(System.in);
        c.r = sc.nextFloat();
        c.t();
        System.out.println("请输入正方形的边长：");
        float bian = sc.nextFloat();
        c.t(bian);
        System.out.println("请输入长方形的长和宽：");
        float chang = sc.nextFloat();
        float kuan = sc.nextFloat();
        c.t(chang, kuan);
    }
}
